﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace PSSMS.View.SysManage
{
    /// <summary>
    /// AccountingW.xaml 的交互逻辑
    /// </summary>
    public partial class AccountingW : UserControl
    {
        BLL.Account.AccountClient myClient = new BLL.Account.AccountClient();
        string strContent = string.Empty;//条件

        //实例化表格：接收数据
        DataTable dtNew = new DataTable();
        public AccountingW()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 用户控件加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AccountW_Loaded(object sender, RoutedEventArgs e)
        {
            //查询往来账务信息
            Accounting(strContent);
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="strContent"></param>
        private void Accounting(string strContent)
        {
            dtNew = myClient.CheckAccount(strContent).Tables[0];
            DgrdModel.ItemsSource = dtNew.DefaultView;
        }
        /// <summary>
        /// 获取选中行
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DgrdModel_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //判断是否选中数据
            if (DgrdModel.SelectedItem != null)
            {
                dtNew = myClient.CheckModular(strContent).Tables[0];
                spxx.ItemsSource = dtNew.DefaultView;
            }
        }
    }
}
